The Page Objects methodology is a popular pattern to write end-to-end tests by wrapping the pages or page fragments of a web app into objects. To know more about it, please read this.
For our sample framework:
tests
for tests in your project. Each file inside it will be loaded as a test.const Test = require("../lib/base-test");
module.exports = new Test({
tags: ["pageobject", "web"],
"Load demo first page": function(client) {
const df = client.page["demo-first"]();
df
.navigate()
.api.resizeWindow(1200, 800);
},
"Verify all cities on first page": function(client) {
client
.page["demo-first"]()
.assert.elContainsText("#tokyo", "Tokyo")
.assert.elContainsText(".city:eq(1) p:eq(1)", "Europe");
},
"Jump to demo second page": function(client) {
client
.page["demo-first"]()
.jumpToSecondDemo();
}
});